<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="timer"></div>

    <p><span class="remainedTime-diffTime" data-timer="1632900600"></span></p>
    <p><span class="remainedTime-diffTime" data-timer="1632282808606"></span></p>
 

    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <script>



        console.log($('title').text("123"))
    console.log(new Date().getTime())
    

    function remainedTimeAct (cls,str_format){ // d,h,m,s
        var startTime_1 = new Date(2021,9,29,12,00,00);
        var endTime_1   = new Date(2022,10,1,13,00,05);
        var testTime = endTime_1.getTime() - startTime_1.getTime();
        var ary_format = str_format.split(',');
        $(cls).each(function(){
            (function (that){
                var diffTime = parseInt(that.attr('data-timer')), //时间差，毫秒
                    obj_time = {},
                    d, h, m, s, clearT;
                function soCount(){
                    d = Math.floor(diffTime/1000/60/60/24);
                    h = Math.floor(diffTime/1000/60/60) % 24;
                    m = Math.floor(diffTime/1000/60) % 60;
                    s = Math.floor(diffTime/1000) % 60;

                    obj_time.d = '<span class="day">' + d + '天</span>';
                    obj_time.h = '<span class="hour">' + (h.toString().length == 1 ? '0' + h : h) + '小时</span>';
                    obj_time.m = '<span class="minute">' + (m.toString().length == 1 ? '0' + m : m) + '分</span>';
                    obj_time.s = '<span class="second">' + (s.toString().length == 1 ? '0' + s : s) + '秒</span>';

                    var html = '';
                    for(var i = 0, len = ary_format.length; i < len; i++){
                        html += obj_time[ary_format[i]];
                    }
                    that.html(html);
                    diffTime -= 1000;
                    clearT = setTimeout(soCount,1000);
                    if(diffTime < 0){
                        clearTimeout(clearT);
                        that.html('已超时');
                    }
                }
                soCount();
            })($(this));
        });
    }

    remainedTimeAct('.remainedTime-diffTime','d,h,m,s')





        // TimeDown('timer', "2021-09-23 8:00:00")
        function TimeDown(id, endDateStr) {
            //结束时间
            var endDate = new Date(endDateStr);
            //当前时间
            var nowDate = new Date();
            //相差的总秒数
            var totalSeconds = parseInt((endDate - nowDate) / 1000);
            //天数
            var days = Math.floor(totalSeconds / (60 * 60 * 24));
            //取模（余数）
            var modulo = totalSeconds % (60 * 60 * 24);
            //小时数
            var hours = Math.floor(modulo / (60 * 60));
            modulo = modulo % (60 * 60);
            //分钟
            var minutes = Math.floor(modulo / 60);
            //秒
            var seconds = modulo % 60;
            //输出到页面
            document.getElementById(id).innerHTML = "剩余抢购:" + days + "天" + hours + "：" + minutes + "：" + seconds;
            //延迟一秒执行自己
            setTimeout(function () {
                TimeDown(id, endDateStr);
            }, 1000)
        }


        var str3 = {};
        var str1 = "./index.php?i=22&c=entry&m=ewei_shopv2&do=mobile&r=goods&isrecommand=1";
        var str = str1.slice(12)
        str2 =String(str.split("&"));
        str4 =  String(str2.split("="));
        str5 = str4.split(",");
        for (var i =0;i<str5.length;i++){
                var key = str5[i];
                str3[key] = str5[i+1];
                i++;
        }
        console.log(str3);

    </script>
</body>
</html>